//
//  Comment.m
//  SDDataTest
//
//  Created by sodao on 12-9-19.
//  Copyright (c) 2012年 sodao. All rights reserved.
//

#import "Comment.h"

@implementation Comment
@synthesize creater;
@synthesize commentContent;
@synthesize date;
@synthesize commentId;
@synthesize replier;
@synthesize show;
@synthesize isLocal;
- (void)encodeWithCoder:(NSCoder *)aCoder{
    [super encodeWithCoder:aCoder];
    [aCoder encodeObject:self.creater forKey:kEncode_Creater];
    [aCoder encodeObject:self.commentContent forKey:kEncode_Content];
    [aCoder encodeObject:self.date forKey:kEncode_date];
    [aCoder encodeObject:self.commentId forKey:kEncode_CommentID];
    [aCoder encodeObject:self.replier forKey:kEncode_Replier];
    [aCoder encodeInt:self.isLocal forKey:kEncode_isLocal];
    [aCoder encodeObject:self.show forKey:kEncode_show];
}
- (id)initWithCoder:(NSCoder *)decoder {
    if (self = [super init]) {
        self.creater = [decoder decodeObjectForKey:kEncode_Creater];
        self.commentContent = [decoder decodeObjectForKey:kEncode_Content];
        self.date = [decoder decodeObjectForKey:kEncode_date];
        self.commentId = [decoder decodeObjectForKey:kEncode_CommentID];
        self.replier = [decoder decodeObjectForKey:kEncode_Replier];
        self.show = [decoder decodeObjectForKey:kEncode_show];
        self.isLocal = [decoder decodeInt32ForKey:kEncode_isLocal];
    }
    return self;
}
-(id)initWithDictionary:(NSDictionary*)dictionary{
    self = [super initWithDictionary:dictionary];
    if (self) {
        self.commentId = [self getFeedIDByObject:[dictionary objectForKey:kEncode_CommentID]];
        self.commentContent=[dictionary objectForKey:kEncode_Content];
        self.isLocal = 0;
    }
    return self;
}
-(void)dealloc{
    [super dealloc];
    if(self.creater)[self.creater release];
    if(self.commentContent)[self.commentContent release];
    if(self.date)[self.date release];
    if(self.commentId)[self.commentId release];
    if(self.replier)[self.replier release];
    if(self.show)[self.show release];
    
}
@end
